package pc29.services;

import pc29.interfaces.SungJuk2IService;
import pc29.model.SungJuk2VO;

public class SungJuk2Service implements SungJuk2IService {

	public void getTotal(SungJuk2VO a) {

		int tot = a.getKor() + a.getEng() + a.getMat();
		a.setTot(tot);
	}

	public void getAverage(SungJuk2VO a) {
		a.setAvg((double) a.getTot() / 3);
	}

	public void getGrade(SungJuk2VO a) {
		char grd;

		switch ((int) a.getAvg() / 10) { 
		case 10:
		case 9:
			grd = SU;
			break;
		case 8:
			grd = WU;
			break;
		case 7:
			grd = MI;
			break;
		case 6:
			grd = YA;
			break;
		default:
			grd = GA;
		}
		a.setGrd(grd);
	}
}
